package com.brillilab.service.module.message.template.impl.plan;

import com.alibaba.fastjson.JSONObject;
import com.brillilab.service.module.message.template.AbstractMessageTemplate;
import com.brillilab.service.module.message.template.enums.MessageTypeEnum;
import lombok.Data;

/**
 * @author zlb
 * @Title: ManagerModifyPlanTimeTemplate
 * @ProjectName brill_lab
 * @Description: TODO
 * @date 2019/11/6 16:00
 */
@Data
public class ManagerModifyPlanTimeTemplate  extends AbstractMessageTemplate {
    private String experimentTargetName;
    private String operatorName;
    private Long topicId;
    private Long topicTargetId;

    /**
     * PI、组长、主执行人帮组员修改了计划时间
     *
     * @param labId                实验室ID
     * @param executorUid          接收人ID
     * @param executor             接收者实验室成员Id
     * @param operatorName         操作人姓名
     * @param experimentTargetName 实验流名称
     * @param topicId              课题ID
     * @param topicTargetId        课题目标ID
     */
    public ManagerModifyPlanTimeTemplate(Long labId, Long executorUid, Long executor, String operatorName, String experimentTargetName, Long topicId, Long topicTargetId) {
        super(labId, executorUid);
        super.setType(MessageTypeEnum.ManagerModifyPlanTime.getValue());
        super.setTitle("计划时间变更");
        String content = String.format("<span style='color:#F6AC2D'>%s</span><span>修改了</span>" +
                "<span style='color:#F6AC2D'>%s</span><span>的时间安排</span>", operatorName, experimentTargetName);
        super.setContent(content);
        super.setAppContent(String.format("%s修改了%s的时间安排", operatorName, experimentTargetName));
        this.labMemberId = executor;
        this.experimentTargetName = experimentTargetName;
        this.operatorName = operatorName;
        this.topicId = topicId;
        this.topicTargetId = topicTargetId;

    }

    @Override
    public String getJsonData() {
        JSONObject object = new JSONObject();
        object.put("topicId", topicId);
        object.put("topicTargetId", topicTargetId);
        object.put("content",appContent);//app推送需必须加入此参数
        return object.toJSONString();
    }
}
